package com.leetcode.datastructure;

/**
 * @author: ZhouBert
 * @date: 2019/10/1
 * @description: leetcode Definition for singly-linked list.
 */
public class ListNode {

	public int val;
	public ListNode next;

	public ListNode(int x) {
		val = x;
	}

	@Override
	public String toString() {
		return "ListNode{" +
				"val=" + val +
				'}';
	}

	/**
	 * 打印单链表 leetcode
	 * @param node
	 */
	public static void print(ListNode node){
		ListNode cur=node;
		while (cur!=null){
			System.out.println(cur.toString());
			cur=cur.next;
		}
	}
}
